package br.furb.models;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

@Entity
@Table(name = "midias")
@NamedQueries({
		@NamedQuery(name = "Midia.searchAsc", query = "select u from Midia u order by u.midiaId asc"),
		@NamedQuery(name = "Midia.searchDesc", query = "select u from Midia u order by u.midiaId desc") })
public class Midia {

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "midia_id", nullable = false, unique = true)
	private Integer midiaId;
	@Column
	private String titulo;
	@Column
	private String descricao;
	@Column(name = "tipo")
	private TipoMidia tipo;

	@ManyToOne
	@JoinColumn(name = "usuario")
	private Usuario usuario;

	/**
	 * @return the descricao
	 */
	public String getDescricao() {
		return descricao;
	}

	/**
	 * @param descricao
	 *            the descricao to set
	 */
	public void setDescricao(String descricao) {
		this.descricao = descricao;
	}

	public Integer getMidiaId() {
		return midiaId;
	}

	public void setMidiaId(Integer midiaId) {
		this.midiaId = midiaId;
	}

	public String getTitulo() {
		return titulo;
	}

	public void setTitulo(String titulo) {
		this.titulo = titulo;
	}

	public TipoMidia getTipo() {
		return tipo;
	}

	public void setTipo(TipoMidia tipo) {
		this.tipo = tipo;
	}

	public Usuario getUsuario() {
		return usuario;
	}

	public void setUsuario(Usuario usuario) {
		this.usuario = usuario;
	}
}
